<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:sch="http://www.ascc.net/xml/schematron"
	xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:smil20="http://www.w3.org/2001/SMIL20/"
	xmlns:smil20lang="http://www.w3.org/2001/SMIL20/Language"
	targetNamespace="http://www.opengis.net/gml" elementFormDefault="qualified" version="3.1.1">
	<annotation>
		<documentation>GML Profile schema for gml:Point,gml:LineString,gml:Polygon,gml:Envelope,
			gml:CirclebyCenterpoint written by Joshua Lieberman. </documentation>
		<documentation>for use by the GeoRSS application schema</documentation>
		<documentation>most optional elements of the full schema have been removed for simplicity</documentation>
		<documentation>Generated by Joshua Lieberman - December 2006</documentation>
	</annotation>
	<import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.w3.org/1999/xlink.xsd" />

	<!-- ================================================= -->
	<element name="Point" type="gml:PointType" substitutionGroup="gml:_GeometricPrimitive" />

	<!-- ================================================= -->
	<complexType name="PointType">

		<annotation>

			<documentation>A Point is defined by a single coordinate tuple.</documentation>

		</annotation>

		<complexContent>

			<extension base="gml:AbstractGeometricPrimitiveType">

				<sequence>

					<choice>

						<annotation>

							<documentation>GML supports two different ways to specify the direct
								poisiton of a point. 1. The "pos" element is of type
								DirectPositionType.</documentation>

						</annotation>

						<element ref="gml:pos" />

					</choice>

				</sequence>

			</extension>

		</complexContent>

	</complexType>

	<!-- ================================================= -->
	<element name="pos" type="gml:DirectPositionType">

		<annotation>

			<appinfo>

				<sch:pattern>

					<sch:rule context="gml:pos">

						<sch:extends rule="CRSLabels" />

					</sch:rule>

				</sch:pattern>

			</appinfo>

		</annotation>

	</element>

	<!-- ================================================= -->
	<complexType name="DirectPositionType">

		<annotation>

			<documentation>DirectPosition instances hold the coordinates for a position within some
				coordinate reference system (CRS). Since DirectPositions, as data types, will often
				be included in larger objects (such as geometry elements) that have references to
				CRS, the "srsName" attribute will in general be missing, if this particular
				DirectPosition is included in a larger element with such a reference to a CRS. In
				this case, the CRS is implicitly assumed to take on the value of the containing
				object's CRS.</documentation>

		</annotation>

		<simpleContent>

			<extension base="gml:doubleList">

				<attributeGroup ref="gml:SRSReferenceGroup" />

			</extension>

		</simpleContent>

	</complexType>

	<!-- ================================================= -->
	<simpleType name="doubleList">

		<annotation>

			<documentation>XML List based on XML Schema double type. An element of this type
				contains a space-separated list of double values</documentation>

		</annotation>

		<list itemType="double" />

	</simpleType>

	<!-- ================================================= -->
	<element name="LineString" type="gml:LineStringType" substitutionGroup="gml:_Curve" />

	<!-- ================================================= -->
	<complexType name="LineStringType">

		<annotation>

			<documentation>A LineString is a special curve that consists of a single segment with
				linear interpolation. It is defined by two or more coordinate tuples, with linear
				interpolation between them. It is backwards compatible with the LineString of GML 2,
				GM_LineString of ISO 19107 is implemented by LineStringSegment.</documentation>

		</annotation>

		<complexContent>

			<extension base="gml:AbstractCurveType">

				<sequence>

					<choice>

						<annotation>

							<documentation>GML supports two different ways to specify the control
								points of a line string. 1. A sequence of "pos" (DirectPositionType)
								or "pointProperty" (PointPropertyType) elements. "pos" elements are
								control points that are only part of this curve, "pointProperty"
								elements contain a point that may be referenced from other geometry
								elements or reference another point defined outside of this curve
								(reuse of existing points). 2. The "posList" element allows for a
								compact way to specifiy the coordinates of the control points, if
								all control points are in the same coordinate reference systems and
								belong to this curve only. The number of direct positions in the
								list must be at least two.</documentation>

						</annotation>

						<element ref="gml:posList" />

					</choice>

				</sequence>

			</extension>

		</complexContent>

	</complexType>

	<!-- ================================================= -->
	<element name="posList" type="gml:DirectPositionListType">

		<annotation>

			<appinfo>

				<sch:pattern>

					<sch:rule context="gml:posList">

						<sch:extends rule="CRSLabels" />

					</sch:rule>

				</sch:pattern>

			</appinfo>

			<appinfo>

				<sch:pattern>

					<sch:rule context="gml:posList">

						<sch:extends rule="Count" />

					</sch:rule>

				</sch:pattern>

			</appinfo>

		</annotation>

	</element>

	<!-- ================================================= -->
	<complexType name="DirectPositionListType">

		<annotation>

			<documentation>DirectPositionList instances hold the coordinates for a sequence of
				direct positions within the same coordinate reference system (CRS).</documentation>

		</annotation>

		<simpleContent>

			<extension base="gml:doubleList">

				<attributeGroup ref="gml:SRSReferenceGroup" />

				<attribute name="count" type="positiveInteger" use="optional">

					<annotation>

						<documentation>"count" allows to specify the number of direct positions in
							the list. If the attribute “count” is present then the attribute
							“srsDimension” shall be present, too.</documentation>

					</annotation>

				</attribute>

			</extension>

		</simpleContent>

	</complexType>
	<!-- =========================================================== -->
	<!-- Envelope -->
	<!-- =========================================================== -->
	<element name="Envelope" type="gml:EnvelopeType" />
	<!-- =========================================================== -->
	<complexType name="EnvelopeType">
		<annotation>
			<documentation>Envelope defines an extent using a pair of positions defining opposite
				corners in arbitrary dimensions. The first direct position is the "lower corner" (a
				coordinate position consisting of all the minimal ordinates for each dimension for
				all points within the envelope), the second one the "upper corner" (a coordinate
				position consisting of all the maximal ordinates for each dimension for all points
				within the envelope).</documentation>
		</annotation>
		<choice>
			<sequence>
				<element name="lowerCorner" type="gml:DirectPositionType" />
				<element name="upperCorner" type="gml:DirectPositionType" />
			</sequence>
		</choice>
		<attributeGroup ref="gml:SRSReferenceGroup" />
	</complexType>
	<!-- =========== global element in "_CurveSegment" substitution group ================ -->
	<element name="CircleByCenterPoint" type="gml:CircleByCenterPointType"
		substitutionGroup="gml:ArcByCenterPoint" />
	<!-- =========================================================== -->
	<complexType name="CircleByCenterPointType">
		<annotation>
			<documentation>A CircleByCenterPoint is an ArcByCenterPoint with identical start and end
				angle to form a full circle. Again, this represenation can be used only in
			2D.</documentation>
		</annotation>
		<complexContent>
			<extension base="gml:ArcByCenterPointType" />
		</complexContent>
	</complexType>
	<!-- ================================================= -->
	<element name="Polygon" type="gml:PolygonType" substitutionGroup="gml:_Surface" />

	<!-- ================================================= -->
	<complexType name="PolygonType">

		<annotation>

			<documentation>A Polygon is a special surface that is defined by a single surface patch.
				The boundary of this patch is coplanar and the polygon uses planar interpolation in
				its interior. It is backwards compatible with the Polygon of GML 2, GM_Polygon of
				ISO 19107 is implemented by PolygonPatch.</documentation>

		</annotation>

		<complexContent>

			<extension base="gml:AbstractSurfaceType">

				<sequence>
					<!-- This profile restricts polygons to one exterior ring and no interior rings -->
					<element ref="gml:exterior" minOccurs="1" maxOccurs="1" />

					<!--               <element ref="gml:interior" minOccurs="0" maxOccurs="unbounded"/>
-->
				</sequence>

			</extension>

		</complexContent>

	</complexType>
	<!-- =========================================================== -->
	<element name="LinearRing" type="gml:LinearRingType" substitutionGroup="gml:_Ring" />
	<!-- =========================================================== -->
	<complexType name="LinearRingType">
		<annotation>
			<documentation>A LinearRing is defined by four or more coordinate tuples, with linear
				interpolation between them; the first and last coordinates must be
			coincident.</documentation>
		</annotation>
		<complexContent>
			<extension base="gml:AbstractRingType">
				<sequence>
					<choice>
						<annotation>
							<documentation>GML supports two different ways to specify the control
								points of a linear ring. 1. A sequence of "pos" (DirectPositionType)
								or "pointProperty" (PointPropertyType) elements. "pos" elements are
								control points that are only part of this ring, "pointProperty"
								elements contain a point that may be referenced from other geometry
								elements or reference another point defined outside of this ring
								(reuse of existing points). 2. The "posList" element allows for a
								compact way to specifiy the coordinates of the control points, if
								all control points are in the same coordinate reference systems and
								belong to this ring only. The number of direct positions in the list
								must be at least four.</documentation>
						</annotation>
						<element ref="gml:posList" />
					</choice>
				</sequence>
			</extension>
		</complexContent>
	</complexType>
	<!-- ================================================= -->
	<element name="exterior" type="gml:AbstractRingPropertyType">

		<annotation>

			<documentation>A boundary of a surface consists of a number of rings. In the normal 2D
				case, one of these rings is distinguished as being the exterior boundary. In a
				general manifold this is not always possible, in which case all boundaries shall be
				listed as interior boundaries, and the exterior will be empty.</documentation>

		</annotation>

	</element>

	<!-- =========== global element in "_CurveSegment" substitution group ================ -->
	<element name="ArcByCenterPoint" type="gml:ArcByCenterPointType"
		substitutionGroup="gml:_CurveSegment" />
	<!-- =========================================================== -->
	<complexType name="ArcByCenterPointType">
		<annotation>
			<documentation> This variant of the arc requires that the points on the arc have to be
				computed instead of storing the coordinates directly. The control point is the
				center point of the arc plus the radius and the bearing at start and end. This
				represenation can be used only in 2D. </documentation>
		</annotation>
		<complexContent>
			<extension base="gml:AbstractCurveSegmentType">
				<sequence>
					<choice>
						<annotation>
							<documentation>GML supports two different ways to specify the control
								points of a curve segment. 1. A "pos" (DirectPositionType) or
								"pointProperty" (PointPropertyType) element. The "pos" element
								contains a center point that is only part of this curve segment, a
								"pointProperty" element contains a point that may be referenced from
								other geometry elements or reference another point defined outside
								of this curve segment (reuse of existing points). 2. The "posList"
								element can be used to specifiy the coordinates of the center point,
								too. The number of direct positions in the list must be
							one.</documentation>
						</annotation>
						<choice>
							<element ref="gml:pos" />
						</choice>
					</choice>
					<element name="radius" type="gml:LengthType">
						<annotation>
							<documentation>The radius of the arc.</documentation>
						</annotation>
					</element>
				</sequence>
				<attribute name="interpolation" type="gml:CurveInterpolationType"
					fixed="circularArcCenterPointWithRadius">
					<annotation>
						<documentation>The attribute "interpolation" specifies the curve
							interpolation mechanism used for this segment. This mechanism uses the
							control points and control parameters to determine the position of this
							curve segment. For an ArcByCenterPoint the interpolation is fixed as
							"circularArcCenterPointWithRadius".</documentation>
					</annotation>
				</attribute>
				<attribute name="numArc" type="integer" use="required" fixed="1">
					<annotation>
						<documentation>Since this type describes always a single arc, the attribute
							is fixed to "1".</documentation>
					</annotation>
				</attribute>
			</extension>
		</complexContent>
	</complexType>
	<!-- =========================================================== -->
	<!-- predefined simple types (enumerations, simple typed arrays) -->
	<!-- =========================================================== -->
	<simpleType name="CurveInterpolationType">
		<annotation>
			<documentation>CurveInterpolationType is a list of codes that may be used to identify
				the interpolation mechanisms specified by an application schema.</documentation>
		</annotation>
		<restriction base="string">
			<enumeration value="linear" />
			<enumeration value="geodesic" />
			<enumeration value="circularArc3Points" />
			<enumeration value="circularArc2PointWithBulge" />
			<enumeration value="circularArcCenterPointWithRadius" />
			<enumeration value="elliptical" />
			<enumeration value="clothoid" />
			<enumeration value="conic" />
			<enumeration value="polynomialSpline" />
			<enumeration value="cubicSpline" />
			<enumeration value="rationalSpline" />
		</restriction>
	</simpleType>
	<!-- ================================================= -->
	<simpleType name="NCNameList">

		<annotation>

			<documentation>A set of values, representing a list of token with the lexical value
				space of NCName. The tokens are separated by whitespace.</documentation>

		</annotation>

		<list itemType="NCName" />

	</simpleType>
	<!-- ================================================= -->
	<complexType name="LengthType">
		<annotation>
			<documentation>Value of a length (or distance) quantity, with its units. Uses the
				MeasureType with the restriction that the unit of measure referenced by uom must be
				suitable for a length, such as metres or feet. </documentation>
		</annotation>
		<simpleContent>
			<extension base="gml:MeasureType" />
		</simpleContent>
	</complexType>
	<!-- =========================================================== -->
	<complexType name="MeasureType">
		<annotation>
			<documentation>Number with a scale. The value of uom (Units Of Measure) attribute is a
				reference to a Reference System for the amount, either a ratio or position scale.
			</documentation>
		</annotation>
		<simpleContent>
			<extension base="double">
				<attribute name="uom" type="anyURI" use="required" />
			</extension>
		</simpleContent>
	</complexType>
	<!-- ================================================= -->
	<!-- The rest of the elements in this schema profile are abstract types or elements. -->
	<!-- ================================================= -->
	<complexType name="AbstractGeometricPrimitiveType" abstract="true">

		<annotation>

			<documentation>This is the abstract root type of the geometric primitives. A geometric
				primitive is a geometric object that is not decomposed further into other primitives
				in the system. All primitives are oriented in the direction implied by the sequence
				of their coordinate tuples.</documentation>

		</annotation>

		<complexContent>

			<extension base="gml:AbstractGeometryType" />

		</complexContent>

	</complexType>

	<!-- ================================================= -->
	<complexType name="AbstractGeometryType" abstract="true">

		<annotation>

			<documentation>All geometry elements are derived directly or indirectly from this
				abstract supertype. A geometry element may have an identifying attribute ("gml:id"),
				a name (attribute "name") and a description (attribute "description"). It may be
				associated with a spatial reference system (attribute "srsName"). The following
				rules shall be adhered: - Every geometry type shall derive from this abstract type.
				- Every geometry element (i.e. an element of a geometry type) shall be directly or
				indirectly in the substitution group of _Geometry.</documentation>

		</annotation>

		<complexContent>

			<extension base="gml:AbstractGMLType">

				<attributeGroup ref="gml:SRSReferenceGroup" />

			</extension>

		</complexContent>

	</complexType>

	<!-- ================================================= -->
	<complexType name="AbstractGMLType" abstract="true">

		<annotation>

			<documentation>All complexContent GML elements are directly or indirectly derived from
				this abstract supertype to establish a hierarchy of GML types that may be
				distinguished from other XML types by their ancestry. Elements in this hierarchy may
				have an ID and are thus referenceable. </documentation>

		</annotation>

		<attribute ref="gml:id" use="optional" />

	</complexType>

	<!-- ================================================= -->
	<attribute name="id" type="ID">

		<annotation>

			<documentation>Database handle for the object. It is of XML type “ID”, so is constrained
				to be unique in the XML document within which it occurs. An external identifier for
				the object in the form of a URI may be constructed using standard XML and XPointer
				methods. This is done by concatenating the URI for the document, a fragment
				separator “#”, and the value of the id attribute. </documentation>

		</annotation>

	</attribute>

	<!-- ================================================= -->
	<attributeGroup name="SRSReferenceGroup">

		<annotation>

			<documentation>Optional reference to the CRS used by this geometry, with optional
				additional information to simplify use when a more complete definition of the CRS is
				not needed. </documentation>

		</annotation>

		<attribute name="srsName" type="anyURI" use="optional">

			<annotation>

				<documentation>In general this reference points to a CRS instance of
					gml:CoordinateReferenceSystemType (see coordinateReferenceSystems.xsd). For well
					known references it is not required that the CRS description exists at the
					location the URI points to. If no srsName attribute is given, the CRS must be
					specified as part of the larger context this geometry element is part of, e.g. a
					geometric element like point, curve, etc. It is expected that this attribute
					will be specified at the direct position level only in rare cases.</documentation>

			</annotation>

		</attribute>

		<attribute name="srsDimension" type="positiveInteger" use="optional">

			<annotation>

				<documentation>The "srsDimension" is the length of coordinate sequence (the number
					of entries in the list). This dimension is specified by the coordinate reference
					system. When the srsName attribute is omitted, this attribute shall be omitted. </documentation>

			</annotation>

		</attribute>

		<!--      <attributeGroup ref="gml:SRSInformationGroup"/>
-->
	</attributeGroup>

	<!-- ================================================= -->
	<element name="_GeometricPrimitive" type="gml:AbstractGeometricPrimitiveType" abstract="true"
		substitutionGroup="gml:_Geometry">

		<annotation>

			<documentation>The "_GeometricPrimitive" element is the abstract head of the
				substituition group for all (pre- and user-defined) geometric primitives.</documentation>

		</annotation>

	</element>

	<!-- ================================================= -->
	<element name="_Geometry" type="gml:AbstractGeometryType" abstract="true"
		substitutionGroup="gml:_GML">

		<annotation>

			<documentation>The "_Geometry" element is the abstract head of the substituition group
				for all geometry elements of GML 3. This includes pre-defined and user-defined
				geometry elements. Any geometry element must be a direct or indirect
				extension/restriction of AbstractGeometryType and must be directly or indirectly in
				the substitution group of "_Geometry".</documentation>

			<appinfo>

				<sch:pattern>

					<sch:rule context="gml:_Geometry">

						<sch:extends rule="CRSLabels" />

					</sch:rule>

				</sch:pattern>

			</appinfo>

		</annotation>

	</element>

	<!-- ================================================= -->
	<element name="_GML" type="gml:AbstractGMLType" abstract="true" substitutionGroup="gml:_Object">

		<annotation>

			<documentation>Global element which acts as the head of a substitution group that may
				include any element which is a GML feature, object, geometry or complex value</documentation>

		</annotation>

	</element>

	<!-- ================================================= -->
	<element name="_Object" abstract="true">

		<annotation>

			<documentation>This abstract element is the head of a substitutionGroup hierararchy
				which may contain either simpleContent or complexContent elements. It is used to
				assert the model position of "class" elements declared in other GML schemas. </documentation>

		</annotation>

	</element>

	<!-- ================================================= -->
	<complexType name="AbstractCurveType" abstract="true">

		<annotation>

			<documentation>An abstraction of a curve to support the different levels of complexity.
				The curve can always be viewed as a geometric primitive, i.e. is continuous.</documentation>

		</annotation>

		<complexContent>

			<extension base="gml:AbstractGeometricPrimitiveType" />

		</complexContent>

	</complexType>

	<!-- ================================================= -->
	<element name="_Curve" type="gml:AbstractCurveType" abstract="true"
		substitutionGroup="gml:_GeometricPrimitive">

		<annotation>

			<documentation>The "_Curve" element is the abstract head of the substituition group for
				all (continuous) curve elements.</documentation>

		</annotation>

	</element>

	<!-- =========================================================== -->
	<element name="_CurveSegment" type="gml:AbstractCurveSegmentType" abstract="true">
		<annotation>
			<documentation>The "_CurveSegment" element is the abstract head of the substituition
				group for all curve segment elements, i.e. continuous segments of the same
				interpolation mechanism.</documentation>
		</annotation>
	</element>
	<!-- =========================================================== -->
	<complexType name="AbstractCurveSegmentType" abstract="true">
		<annotation>
			<documentation> Curve segment defines a homogeneous segment of a curve. </documentation>
		</annotation>
	</complexType>
	<!-- ================================================= -->
	<complexType name="AbstractSurfaceType">

		<annotation>

			<documentation> An abstraction of a surface to support the different levels of
				complexity. A surface is always a continuous region of a plane. </documentation>

		</annotation>

		<complexContent>

			<extension base="gml:AbstractGeometricPrimitiveType" />

		</complexContent>

	</complexType>


	<!-- ================================================= -->
	<complexType name="AbstractRingPropertyType">

		<annotation>

			<documentation> Encapsulates a ring to represent the surface boundary property of a
				surface. </documentation>

		</annotation>

		<sequence>

			<element ref="gml:_Ring" />

		</sequence>

	</complexType>

	<!-- ================================================= -->
	<element name="_Ring" type="gml:AbstractRingType" abstract="true"
		substitutionGroup="gml:_Geometry">

		<annotation>

			<documentation>The "_Ring" element is the abstract head of the substituition group for
				all closed boundaries of a surface patch.</documentation>

		</annotation>

	</element>

	<!-- ================================================= -->
	<complexType name="AbstractRingType" abstract="true">

		<annotation>

			<documentation> An abstraction of a ring to support surface boundaries of different
				complexity. </documentation>

		</annotation>

		<complexContent>

			<extension base="gml:AbstractGeometryType" />

		</complexContent>

	</complexType>

	<!-- ================================================= -->
	<!--   <element name="interior" type="gml:AbstractRingPropertyType">
		
      <annotation>
			
         <documentation>A boundary of a surface consists of a number of rings. The "interior" rings separate the surface / surface patch from the area enclosed by the rings.</documentation>
		
      </annotation>
	
   </element>
-->
	<!-- ================================================= -->
	<element name="_Surface" type="gml:AbstractSurfaceType" abstract="true"
		substitutionGroup="gml:_GeometricPrimitive">

		<annotation>

			<documentation>The "_Surface" element is the abstract head of the substituition group
				for all (continuous) surface elements.</documentation>

		</annotation>

	</element>
	<!-- =========================================================== -->
</schema>
